home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / insuranc.swf / scripts / __Packages / MissionInfo.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  4.1 KB  |  152 lines

  1. class MissionInfo extends MovieClip
  2. {
  3.    var mcInfo;
  4.    var mcCar;
  5.    var oList;
  6.    var btnEasyMoney;
  7.    function MissionInfo()
  8.    {
  9.       super();
  10.       if(Game.level == 0)
  11.       {
  12.          this.mcInfo.gotoAndStop(2);
  13.       }
  14.       else
  15.       {
  16.          this.mcInfo.gotoAndStop(5 + Game.level);
  17.       }
  18.       this.mcCar.mcWeapon.gotoAndStop(Game.getInstance().sEnemy);
  19.    }
  20.    function init()
  21.    {
  22.       if(Game.level > 0)
  23.       {
  24.          this.mcCar.mcWeapon.mcAnim.gotoAndPlay("show");
  25.       }
  26.       this.setInfo();
  27.       this.oList = new Object();
  28.       this.oList.onKeyDown = mx.utils.Delegate.create(this,this.onKeyDown);
  29.       Key.addListener(this.oList);
  30.       this.mcInfo.btnEasyMoney.onRelease = mx.utils.Delegate.create(this,this.onReleaseEasyMoney);
  31.       trace(this.btnEasyMoney);
  32.       Sounds.stopSound("engineIdle");
  33.       Sounds.playSound("engineIdle",99999);
  34.    }
  35.    function close(Void)
  36.    {
  37.       Game.getInstance().initLevel();
  38.       Game.getInstance().startWork();
  39.       this.removeMovieClip();
  40.    }
  41.    function onKeyDown(Void)
  42.    {
  43.       if(Key.isDown(38))
  44.       {
  45.          if(!Application.bEasy && this.mcInfo._currentframe == 2)
  46.          {
  47.             Application.bEasy = true;
  48.             this.mcInfo.mcArrows._y = 110;
  49.             Game.getInstance().setLives();
  50.          }
  51.       }
  52.       else if(Key.isDown(40))
  53.       {
  54.          if(Application.bEasy && this.mcInfo._currentframe == 2)
  55.          {
  56.             Application.bEasy = false;
  57.             this.mcInfo.mcArrows._y = 130;
  58.             Game.getInstance().setLives();
  59.          }
  60.       }
  61.       if(Key.isDown(32))
  62.       {
  63.          if(this.mcInfo._currentframe < 5)
  64.          {
  65.             this.mcInfo.nextFrame();
  66.             this.setInfo();
  67.          }
  68.          else
  69.          {
  70.             Key.removeListener(this.oList);
  71.             this.mcCar.mcWeapon.mcAnim.gotoAndPlay("hide");
  72.             ┬º┬ºpush(this.gotoAndPlay("out"));
  73.          }
  74.       }
  75.    }
  76.    function setInfo(Void)
  77.    {
  78.       if(this.mcInfo.btnNext.onRelease == undefined)
  79.       {
  80.          this.mcInfo.btnNext.onRelease = mx.utils.Delegate.create(this,this.onReleaseNext);
  81.       }
  82.       if(this.mcInfo._currentframe == 2)
  83.       {
  84.          this.mcInfo.btnEasy.onRollOver = mx.utils.Delegate.create(this,this.onRollOverEasy);
  85.          this.mcInfo.btnEasy.onRelease = mx.utils.Delegate.create(this,this.onReleaseEasy);
  86.          this.mcInfo.btnHard.onRollOver = mx.utils.Delegate.create(this,this.onRollOverHard);
  87.          this.mcInfo.btnHard.onRelease = mx.utils.Delegate.create(this,this.onReleaseHard);
  88.          if(Application.bEasy)
  89.          {
  90.             this.mcInfo.mcArrows._y = 110;
  91.          }
  92.          else
  93.          {
  94.             this.mcInfo.mcArrows._y = 130;
  95.          }
  96.       }
  97.       else if(this.mcInfo._currentframe >= 5)
  98.       {
  99.          if(this.mcInfo._currentframe == 5)
  100.          {
  101.             this.mcCar.mcWeapon.mcAnim.gotoAndPlay("show");
  102.          }
  103.       }
  104.    }
  105.    function onReleaseNext(Void)
  106.    {
  107.       trace(this.mcInfo._currentframe);
  108.       if(this.mcInfo._currentframe < 5)
  109.       {
  110.          this.mcInfo.nextFrame();
  111.          this.setInfo();
  112.       }
  113.       else
  114.       {
  115.          Key.removeListener(this.oList);
  116.          this.mcInfo.btnNext.onRelease = null;
  117.          this.mcCar.mcWeapon.mcAnim.gotoAndPlay("hide");
  118.          ┬º┬ºpush(this.gotoAndPlay("out"));
  119.       }
  120.    }
  121.    function onRollOverEasy(Void)
  122.    {
  123.       Application.bEasy = true;
  124.       this.mcInfo.mcArrows._y = 110;
  125.       Game.getInstance().setLives();
  126.    }
  127.    function onReleaseEasy(Void)
  128.    {
  129.       Application.bEasy = true;
  130.       this.mcInfo.mcArrows._y = 110;
  131.       Game.getInstance().setLives();
  132.       this.onReleaseNext();
  133.    }
  134.    function onRollOverHard(Void)
  135.    {
  136.       Application.bEasy = false;
  137.       this.mcInfo.mcArrows._y = 130;
  138.       Game.getInstance().setLives();
  139.    }
  140.    function onReleaseHard(Void)
  141.    {
  142.       Application.bEasy = false;
  143.       this.mcInfo.mcArrows._y = 110;
  144.       Game.getInstance().setLives();
  145.       this.onReleaseNext();
  146.    }
  147.    function onReleaseEasyMoney(Void)
  148.    {
  149.       this.getURL("http://www.easymoney.com","_blank");
  150.    }
  151. }
  152.